package com.zjdiepu.www.diepu.api;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.diepu.www.client.proxy.partner.request.divi.ApplyDiviProxyRequest;
import com.diepu.www.client.proxy.partner.request.divi.SynDiviAttachmentsRequest;
import com.zjdiepu.www.diepu.biz.IDiepuProxyService;
import com.zjdiepu.www.response.BaseResponse;
import com.zjdiepu.www.response.BooleanResponse;
import com.zjdiepu.www.security.exception.BasePartnerException;
import com.zjdiepu.www.security.server.convert.MyJson;
import com.zjdiepu.www.security.server.core.Partners;
import com.zjdiepu.www.security.server.interceptor.PartnerProvider;

/**
 * 类描述:杭州银行分期<br/> 
 * 项目名称:diepu-parent-partner <br/> 
 * 类名称:HzicbcDiviController <br/>     
 * 创建人:xiongxiaotun <br/> 
 * 创建时间:2017年8月15日 下午5:56:32  <br/>   
 * 修改人:xiongxiaotun <br/> 
 * 修改时间: 2017年8月15日 下午5:56:32   <br/>  
 * 修改备注:   <br/> 
 * @version V1.0   <br/>
 */
@MyJson
@RestController
@RequestMapping(value="HzicbcDiviController", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@Api(tags = { "杭州银行分期" }, produces = "application/json;charset=UTF-8")
@PartnerProvider(partner = Partners.DIE_PU)
public class HzicbcDiviController {
	@Resource
	private IDiepuProxyService diepuProxyService;
	
	/**
	 * @author xiongxiaotun <br/>
	 * @Title: applyDivi <br/>
	 * @Description: 申请杭州银行分期 <br/>
	 * @param applyDiviProxyRequest
	 * @return
	 * @version V1.0 <br/>
	 * @throws BasePartnerException 
	 */
	@ApiOperation(value = "申请杭州银行分期", response = BaseResponse.class, httpMethod = "POST")
	@RequestMapping("applyDivi")
	public BaseResponse<BooleanResponse> applyDivi(@Validated @RequestBody ApplyDiviProxyRequest applyDiviProxyRequest) throws BasePartnerException {
		boolean result = diepuProxyService.saveApplyDivi(applyDiviProxyRequest);
		return BaseResponse.successWithBoolean(result);
	}
	
	/**
	 * @author xiongxiaotun <br/>
	 * @Title: synDiviAttachments <br/>
	 * @Description: 单独同步附件列表 <br/>
	 * @param synDiviAttachmentsRequest
	 * @return
	 * @version V1.0 <br/>
	 * @throws BasePartnerException 
	 */
	@ApiOperation(value = "单独同步附件列表", response = BaseResponse.class, httpMethod = "POST")
	@RequestMapping("synDiviAttachments")
	public BaseResponse<BooleanResponse> synDiviAttachments(@Validated @RequestBody SynDiviAttachmentsRequest synDiviAttachmentsRequest) throws BasePartnerException {
		boolean result = diepuProxyService.synDiviAttachments(synDiviAttachmentsRequest);
		return BaseResponse.successWithBoolean(result);
	}
	
}
